{echo:JS::import("form")}
{echo:JS::import('dialog?skin=tinysimple');}
{echo:JS::import('dialogtools');}
<link type="text/css" rel="stylesheet" href="{url:#css/ucenter.css}" />
<div class="container clearfix">
	{widget:name=sub_navs action=ucsidebar sidebar=$sidebar act=$actionId}
	<div class="content clearfix uc-content">
		<h1 class="title"><span>申请资助：</span></h1>
		{set:$uid=$user[id]}
		<div class="mt10">
		<table class="simple">
		<tr><td>当前信用币</td><td>借款累计</td><td>还款累计</td><td>利息累计</td><td>待还累计</td></tr>
		<tr class="red">
		<td>{$customer['xyb']|'0'}</td>
		<td>{$currency_symbol}{echo:Zyk_tj::sum('pd','sq_money',"sq_id=$uid and is_ok>1")|0}</td>
		<td>{$currency_symbol}{echo:Zyk_tj::sum('pd','h_money',"sq_id=$uid and is_ok=3")|0}</td>
		<td>{$currency_symbol}{echo:Zyk_tj::sum('pd','lx_money',"sq_id=$uid and is_ok=3")|0}</td>
		<td>{$currency_symbol}{echo:Zyk_tj::sum('pd','sq_money',"sq_id=$uid and is_ok=2")+Zyk_tj::sum('pd','lx_money',"sq_id=$uid and is_ok=2")}</td>
		</tr>
	</table>
	<form id="sq_form" action="{url:/ucenter/jk_add}" method="post" target="_blank" callback="submit_sq">
		<table class="form">
			<tr>
				<td >担保人：</td>
				<td class="f12"><input type="text" name="dbr" id="dbr" pattern="name" style="width: 110px;" alt="担保人必须是股东身份">&nbsp;&nbsp;&nbsp;&nbsp;<label class="hs">担保人必须是股东身份</label></td>
			</tr>
			<tr>
				<td >申请金额：</td>
				<td class="f12"><input type="text" name="sq_je" id="sq_je" pattern="int" min="{$dk_qdje}" style="width: 80px;" alt="填写整数，不低于{$dk_qdje}">&nbsp;&nbsp;&nbsp;&nbsp;<label class="hs">填写整数，不低于{$dk_qdje}</label>
				</td>  
			</tr>
			<tr>
				<td class="f12">二级密码：</td>
				<td><input type="password" name="pass2" id="pass2" pattern="required" style="width: 150px;" alt="输入二级密码"> <label></label></td>
			</tr>
			<tr>
				<td colspan="2" class="tc"><input type="submit" class="btn btn-main" value="提交"></td>
			</tr>
			<tr>
				<td colspan="2" class="f12 text-warning">* 信用币达到30000才有资格申请资助！<br>* 申请成功后系统会在资助频道展示您的资助信息，请等待资助人的资助！<br>* 所有获得资助的款项只能在平台内使用！<br>* 从获得资助起须{echo:Common::getConfigJjsetValue('dk_qx')}个月内本息一起还给资助人，过期不还，系统将对申请人和担保人封号处理！</td>
			</tr>
		</table>
	</form>
		</div>
		<div class="mt20 tab">
			<ul class="tab-head">
				<li>待审核<i></i></li>
				<li>待资助<i></i></li>
				<li>进行中<i></i></li>
				<li>已还款<i></i></li>
			</ul>
			<div class="tab-body">
			<!-- 待审核 -->
				<div>
					<table class="simple">
						<tr>
							<th width="70">申请时间</th><th width="40">申请金额</th><th width="40">还款金额</th> <th width="30">期限</th><th width="50">申请人</th> <th width="50">资助人</th><th width="70">资助时间</th><th width="70">还款时间</th><th width="80">状态 / 操作</th>
						</tr>
						{query:name=pd where=sq_id eq $user[id] and is_ok eq 0 order=pd_id desc page=1 id=$obj1}
						<tr class="{if:$key%2==1}odd{else:}even{/if} {if:$item['status']==2}noborder{/if}">
							<td>{$item['sq_time']}</td> <td >{$currency_symbol}{$item['sq_money']}</td><td >{$currency_symbol}{$item['h_money']}</td><td >{$item['qx']}个月</td><td>{echo:Common::getC($item['dbr_id'])['real_name']}</td> <td >{echo:Common::getC($item['fc_id'])['real_name']}</td><td >{$item['fc_time']}</td><td >{$item['h_time']}</td> <td>{echo:Common::getZzt($item[is_ok])} <a href="javascript:confirm_action('{url:/ucenter/zzsq_del/id/$item[pd_id]}','确认要取消吗？')" class="btn btn-main btn-mini">取消</a></td>
						</tr>
						{/query}
					</table>
					<div class="page-nav">{echo:$obj1->pagebar()}</div>
				</div>
			<!-- 待放款 -->
				<div>
					<table class="simple">
						<tr>
							<th width="70">申请时间</th><th width="40">申请金额</th><th width="40">还款金额</th> <th width="30">期限</th><th width="50">申请人</th> <th width="50">资助人</th><th width="70">资助时间</th><th width="70">还款时间</th><th width="80">状态 / 操作</th>
						</tr>
						{query:name=pd where=sq_id eq $user[id] and is_ok eq 1 order=pd_id desc page=1 id=$obj2}
						<tr class="{if:$key%2==1}odd{else:}even{/if} {if:$item['status']==2}noborder{/if}">
							<td>{$item['sq_time']}</td> <td >{$currency_symbol}{$item['sq_money']}</td><td >{$currency_symbol}{$item['h_money']}</td><td >{$item['qx']}个月</td><td>{echo:Common::getC($item['dbr_id'])['real_name']}</td> <td >{echo:Common::getC($item['fc_id'])['real_name']}</td><td >{$item['fc_time']}</td><td >{$item['h_time']}</td> <td>{echo:Common::getZzt($item[is_ok])} <a href="javascript:confirm_action('{url:/ucenter/zzsq_del/id/$item[pd_id]}','确认要取消吗？')" class="btn btn-main btn-mini">取消</a></td>
						</tr>
						{/query}
					</table>
					<div class="page-nav">{echo:$obj2->pagebar()}</div>
				</div>
			<!-- 放款 -->
				<div>
					<table class="simple">
						<tr>
							<th width="70">申请时间</th><th width="40">申请金额</th><th width="40">还款金额</th> <th width="30">期限</th><th width="50">申请人</th> <th width="50">资助人</th><th width="70">资助时间</th><th width="70">还款时间</th><th width="80">状态 / 操作</th>
						</tr>
						{query:name=pd where=sq_id eq $user[id] and is_ok eq 2 order=pd_id desc page=1 id=$obj3}
						<tr class="{if:$key%2==1}odd{else:}even{/if} {if:$item['status']==2}noborder{/if}">
							<td>{$item['sq_time']}</td> <td >{$currency_symbol}{$item['sq_money']}</td><td >{$currency_symbol}{$item['h_money']}</td><td >{$item['qx']}个月</td><td>{echo:Common::getC($item['dbr_id'])['real_name']}</td> <td >{echo:Common::getC($item['fc_id'])['real_name']}</td><td >{$item['fc_time']}</td><td >{$item['h_time']}</td> <td>{echo:Common::getZzt($item[is_ok])} <a href="{url:/ucenter/zzsq_hk/id/$item[pd_id]}" class="btn btn-main btn-mini">还款</a></td>
						</tr>
						{/query}
					</table>
					<div class="page-nav">{echo:$obj3->pagebar()}</div>
				</div>
			<!-- 还款 -->
				<div>
					<table class="simple">
						<tr>
							<th width="90">申请时间</th><th width="40">申请金额</th><th width="40">还款金额</th> <th width="40">期限</th><th width="50">担保人</th> <th width="50">资助人</th><th width="90">资助时间</th><th width="90">还款时间</th><th width="40">状态</th>
						</tr>
						{query:name=pd where=sq_id eq $user[id] and is_ok eq 3 order=pd_id desc page=1 id=$obj4}
						<tr class="{if:$key%2==1}odd{else:}even{/if} {if:$item['status']==2}noborder{/if}">
							<td>{$item['sq_time']}</td> <td >{$currency_symbol}{$item['sq_money']}</td><td >{$currency_symbol}{$item['h_money']}</td><td >{$item['qx']}个月</td><td>{echo:Common::getC($item['dbr_id'])['real_name']}</td> <td >{echo:Common::getC($item['fc_id'])['real_name']}</td><td >{$item['fc_time']}</td><td >{$item['h_time']}</td> <td>{echo:Common::getZzt($item[is_ok])}</td>
						</tr>
						{/query}
					</table>
					<div class="page-nav">{echo:$obj4->pagebar()}</div>
				</div>	
			</div>
		</div>
	</div>
</div>

<script>
	function submit_sq(e){
		if(!e){
			var dbr = $("#dbr").val();
			var sq_je = $("#sq_je").val();
			var pass2 = $("#pass2").val();
			$.get("{url:/ucenter/jk_add}",{dbr:dbr,pass2:pass2,sq_je:sq_je},function(data){
				if(data['status']=='success'){
					art.dialog.tips("<p class='"+data['status']+"'>"+data['msg']+"</p>",2);
            		setTimeout("tools_reload()",2000);
					window.location.href = "{url:/ucenter/application_support/rand/}"+Math.random()+"#tab-0";
				}else{
					alert(data['msg']);
				}
			},'json');
		}
		return false;
	}

</script>
